package com.yanqu.road.entity.activity.businessreunion;

import com.yanqu.road.entity.DataObject;

import java.util.Objects;

/**
 * @author ：zfr
 * @date ：2022/4/18 17:53
 */
public class BusinessReunionBindData extends DataObject {
    private long userId;
    private int activityId;
    private String recallCode = "";
    private String preBindRecallCode = "";
    private int addVipExp;
    private int preAddVipExp;

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        this.userId = userId;
    }

    public int getActivityId() {
        return activityId;
    }

    public void setActivityId(int activityId) {
        this.activityId = activityId;
    }

    public String getRecallCode() {
        return recallCode;
    }

    public void setRecallCode(String recallCode) {
        if (!Objects.equals(this.recallCode, recallCode)) {
            this.recallCode = recallCode;
            setUpdateOption();
        }
    }

    public String getPreBindRecallCode() {
        return preBindRecallCode;
    }

    public void setPreBindRecallCode(String preBindRecallCode) {
        this.preBindRecallCode = preBindRecallCode;
    }

    public boolean isBind() {
        return (!preBindRecallCode.isEmpty() || !recallCode.isEmpty());
    }

    public int getAddVipExp() {
        return addVipExp;
    }

    public void setAddVipExp(int addVipExp) {
        if (this.addVipExp != addVipExp) {
            this.addVipExp = addVipExp;
            setUpdateOption();
        }
    }

    public int getPreAddVipExp() {
        return preAddVipExp;
    }

    public void setPreAddVipExp(int preAddVipExp) {
        this.preAddVipExp = preAddVipExp;
    }

    public void resetPreBind() {
        setPreBindRecallCode("");
        setPreAddVipExp(0);
    }

    public void recallBindSuccess(String recallCode) {
        setRecallCode(recallCode);
        setAddVipExp(getPreAddVipExp());
    }

    public void resetBind() {
        setRecallCode("");
        setAddVipExp(0);
        resetPreBind();
    }
}
